<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /* 水仙花数是一种特殊的四位数，它的特点就是，每个数位的四次方和，等于它本身。请编程找出来。 */
        // var num = prompt("请输入一个四位数数：", );
        var ge, shi, bai, qian;
        var result;
        for(var i = 1000; i <= 9999; i++) {
            qian = parseInt( i / 1000 );
            bai = parseInt( (i - qian * 1000) / 100);
            shi = parseInt( (i - qian * 1000 - bai * 100) / 10);
            ge = i % 10;
            if( i == qian ** 4 + bai ** 4 + shi ** 4 + ge ** 4) {
                console.log(i);
            }
        }

        
    </script>
</body>
</html>